home *** CD-ROM | disk | FTP | other *** search
- #include "lib.h"
-
- /*
- * memset - set bytes
- *
- * CHARBITS should be defined only if the compiler lacks "unsigned char".
- * It should be a mask, e.g. 0377 for an 8-bit machine.
- */
-
- #ifndef CHARBITS
- # define UNSCHAR(c) ((unsigned char)(c))
- # define uchar unsigned char
- #else
- # define UNSCHAR(c) ((c)&CHARBITS)
- # define uchar char
- #endif
-
- _VOIDSTAR
- memset(s, ucharfill, size)
- _VOIDSTAR s;
- register int ucharfill;
- _SIZET size;
- {
- register uchar *scan;
- register _SIZET n;
- register int uc;
-
- scan = s;
- uc = UNSCHAR(ucharfill);
- for (n = size; n > 0; n--)
- *scan++ = uc;
-
- return(s);
- }
-